package tech.aistar.mapper;





import org.apache.ibatis.annotations.*;
import org.springframework.data.repository.query.Param;
import org.springframework.stereotype.Repository;
import tech.aistar.pojo.User;

import java.util.List;

@Mapper
@Repository

public interface UserMapper {
    @Select("select * from user")
    List<User> findAll();

    @Select("select * from user where username=#{value}")
    User findByUsername(String username);

    @Select("select u_name,u_photo,intro,u_gender from user")
    List<User> findXinXi();

    @Select("select * from user where phone=#{phone}")
    User findByPhone(String phone);
    @Insert("insert into user(phone,password,username) values(#{phone},#{password},#{username})")
    int inset(@Param("phone") String phone, @Param("password") String password, @Param("username") String username);

    @Update("update user set username=#{username},intro=#{intro} where phone=#{phone}" )
    int update(@Param("username") String username, @Param("intro") String intro , @Param("phone") String phone);

    @Update("update user set u_photo=#{uPhoto} where phone=#{phone} " )
    int updatePhoto(  @Param("uPhoto") String uPhoto , @Param("phone") String phone);
    @Update("update user set u_name=#{vipname},members=#{state},notes=#{startime},u_gender=#{endtime} where u_id=#{uid}")
    void upvip(String vipname,int state,String startime,String endtime,int uid);
    @Select("select members from user where u_id=#{value}")
    int selede(int uid);
}
